package com.hsjk.szwj.module.system.dal.mysql.service;

import java.util.*;

import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.framework.mybatis.core.mapper.BaseMapperX;
import com.hsjk.szwj.module.system.dal.dataobject.service.TenantServiceDO;
import org.apache.ibatis.annotations.Mapper;
import com.hsjk.szwj.module.system.controller.admin.service.vo.*;

/**
 * 套餐服务关联 Mapper
 *
 * @author ec50n9
 */
@Mapper
public interface TenantServiceMapper extends BaseMapperX<TenantServiceDO> {

    default PageResult<TenantServiceDO> selectPage(TenantServicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantServiceDO>()
                .eqIfPresent(TenantServiceDO::getServiceId, reqVO.getServiceId())
                .betweenIfPresent(TenantServiceDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(TenantServiceDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(TenantServiceDO::getTenantId, reqVO.getTenantId())
                .betweenIfPresent(TenantServiceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantServiceDO::getId));
    }

    default List<TenantServiceDO> selectList(TenantServiceExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<TenantServiceDO>()
                .eqIfPresent(TenantServiceDO::getServiceId, reqVO.getServiceId())
                .betweenIfPresent(TenantServiceDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(TenantServiceDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(TenantServiceDO::getTenantId, reqVO.getTenantId())
                .betweenIfPresent(TenantServiceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantServiceDO::getId));
    }

}
